package edu.uclmgmu.bacteriosec.aspects.com.mysql.jdbc.ResultSet.next;

//import com.mysql.jdbc.ResultSet;
import edu.uclmgmu.bacteriosec.aspects.common.FilesStore;

privileged aspect Negate {

	boolean around(java.sql.ResultSet caller) : target(caller)&& 
			call(boolean java.sql.ResultSet.next()) && 
			!cflow(within(Negate)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) {
		String metodoQueToca = FilesStore.loadMethodInTurn();
		String signature=thisJoinPointStaticPart.getSignature().toString();
		if (metodoQueToca.equals(signature)) {
			int numberOfCallInTurn = FilesStore.loadCallInTurn();
			int numberOfCurrentCall = FilesStore.loadCurrentCall();
			String testCase=FilesStore.loadCurrentTestCase();
			if (numberOfCallInTurn == numberOfCurrentCall) {
				FilesStore.createFileForCurrentCall(metodoQueToca,testCase, numberOfCurrentCall+1);
				return !proceed(caller);
			} else {
				FilesStore.createFileForCurrentCall(metodoQueToca,testCase, numberOfCurrentCall+1);
				return proceed(caller);
			}
		} else {
			System.out.println(metodoQueToca + "; " + signature);
			return proceed(caller);
		}
	}

}
